<template>
  <div class="d_mainFlex">
    <!-- <div class="d_treeBox p10">
      <el-form
        ref="materForm"
        :model="form"
        :rules="rules"
        hide-required-asterisk
        label-width="auto"
        class="dialogForm dialogInlineForm"
        label-position="top"
      >
        <el-row>
          <el-col>
            <el-form-item label="操作人员">
              <div class="flex">
                <el-input
                  v-model="name"
                  size="small"
                  placeholder="输入工号或扫码"
                  disabled
                />
                <el-button
                  size="small"
                  type="primary"
                  style="margin-left: 5px; min-width: 70px"
                  @click="loginModel = true"
                  >切换</el-button
                >
              </div>
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="生产单号" prop="produceTaskBillNo">
              <el-input
                v-model="form.produceTaskBillNo"
                size="small"
                ref="produceTaskBillNo"
                @keyup.enter.native="handleSave"
                placeholder="输入生产单号或扫码"
              />
            </el-form-item>
          </el-col>
          <el-col>
            <el-button
              type="primary"
              size="small"
              style="width: 100%; margin-top: 10px"
              @click.native.prevent="handleSave"
              >确定</el-button
            >
          </el-col>
        </el-row>
      </el-form>
    </div> -->
    <div class="case">
      <na-table
        :datas.sync="tableData"
        :searchObj.sync="search"
        @updateDatas="getAllMaterils"
        @checkboxChange="handleisDisabledChange"
        @otherChange="handleisDisabledChange"
      >
      </na-table>
    </div>

    <!-- 切换账号 -->
    <el-dialog
      title="快速登录"
      :visible.sync="loginModel"
      :close-on-click-modal="false"
      custom-class="bodyNoPadDialog "
      width="25%"
    >
      <div class="p16 pt0">
        <el-form
          ref="loginForm"
          :model="loginForm"
          :rules="loginRules"
          hide-required-asterisk
          label-width="auto"
          class="dialogForm dialogInlineForm"
          label-position="top"
        >
          <el-row>
            <el-col>
              <el-form-item label="登录账号" prop="loginAccount">
                <el-input
                  v-model="loginForm.loginAccount"
                  size="small"
                  placeholder="输入登录账号"
                />
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="登录密码" prop="loginPassWord">
                <el-input
                  v-model="loginForm.loginPassWord"
                  size="small"
                  show-password
                  placeholder="输入登录密码"
                />
              </el-form-item>
            </el-col>
            <el-col>
              <el-button
                type="primary"
                size="small"
                style="width: 100%; margin-top: 10px"
                @click.native.prevent="handleLogin"
                >确认登录</el-button
              >
            </el-col>
          </el-row>
        </el-form>
      </div>
    </el-dialog>

    <!-- 生产工艺列表 -->
    <el-dialog
      title="选择生产工艺"
      :visible.sync="workmanshipModel"
      :close-on-click-modal="false"
      custom-class="bodyNoPadDialog bigDialog bigDialogh85"
      width="85%"
      v-loading="listLoading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
    >
      <div class="list list_3 p16">
        <div
          class="list-item"
          :class="[
            {
              finish: item.craftTaskState == 2,
              conduct: item.craftTaskState == 1 || item.craftTaskState == 3,
            },
          ]"
          v-for="(item, index) in workmanshipList"
          :key="index"
          @click="handleItem(item, index)"
        >
          <div class="head-info">
            <div>
              <span>工序：{{ item.produceCraftSort }}</span>
              <span class="ml16"
                >计划用时：{{ item.craftTaskPlanUseTime }}分钟</span
              >
            </div>
            <div>
              <span v-if="item.craftTaskState == 0">状态：待开始</span>
              <span v-else-if="item.craftTaskState == 1">状态：进行中</span>
              <span v-else-if="item.craftTaskState == 2">状态：已完成</span>
              <span v-else-if="item.craftTaskState == 3">状态：流转</span>
            </div>
          </div>
          <div class="item-content">
            <h1>{{ item.craftName }}</h1>
            <p>{{ item.machineName }}</p>
          </div>
        </div>
        <el-empty
          :image-size="200"
          v-if="workmanshipList.length < 1"
          style="margin: 150px auto"
          description="暂无工艺"
        >
        </el-empty>
      </div>
    </el-dialog>

    <!-- 完成机台作业   -->
    <el-dialog
      :title="Matitle"
      :visible.sync="showAddDialog"
      :close-on-click-modal="false"
      custom-class="bodyNoPadDialog bigDialog bigDialogh85"
      width="85%"
    >
      <div class="dialogDody">
        <div class="subTipBtn">
          <span class="mr15"
            ><span class="mr5">作业单号：</span
            >{{ machiaForm.workTaskNo || "系统自动生成" }}</span
          >
          <span class="mr15"
            ><span class="mr5">创建日期：</span
            >{{
              machiaForm.workBeginTime || dayjs().format("YYYY-MM-DD")
            }}</span
          >
          <span
            ><span class="mr5">创建人员：</span
            >{{ machiaForm.workPersonName }}</span
          >
        </div>
        <el-form
          ref="machiaForm"
          :model="machiaForm"
          :rules="rulesFrom"
          class="dialogForm h100"
          label-width="90px"
        >
          <el-row class="h100">
            <el-col :span="18" class="fleft h100">
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="订单单号" prop="xieYiShuHao">
                    <el-input
                      v-model="machiaForm.saleOrderGroupNumber"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="生产单号" prop="produceTaskBillNo">
                    <el-input
                      v-model="machiaForm.produceTaskBillNo"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="作业单号" prop="workTaskNo">
                    <el-input
                      v-model="machiaForm.workTaskNo"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="产品名称" prop="orderProductName">
                    <el-input
                      v-model="machiaForm.orderProductName"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="工艺名称" prop="produceCraftName">
                    <el-input
                      v-model="machiaForm.produceCraftName"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="操作人员" prop="workPersonName">
                    <el-input
                      v-model="machiaForm.workPersonName"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="机台名称" prop="produceMachineName">
                    <el-input
                      v-model="machiaForm.produceMachineName"
                      size="mini"
                      disabled
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="生产设备" prop="equipmentCode">
                    <el-select
                      filterable
                      v-model="machiaForm.equipmentCode"
                      size="mini"
                      placeholder="请选择生产设备"
                      :disabled="allcanDisablle || equipment.length < 1"
                    >
                      <el-option
                        v-for="item in equipment"
                        :key="item.equipmentNo"
                        :label="item.equipmentName"
                        :value="item.equipmentNo"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="副手人员" prop="assistantList">
                    <div class="flex permain">
                      <div class="input">
                        <template v-for="(v, p) in assisList">
                          <span
                            :key="v.employeeCode"
                            class="pointer"
                            @click="deletrPer(p) && allcanDisablle"
                            v-if="p < 3"
                          >
                            {{ v.employeeName }}<i class="el-icon-close" />
                          </span>
                          <span class="pointer" v-if="p == 3"
                            >+{{ assisList.length - p }}</span
                          >
                        </template>
                      </div>
                      <el-button
                        class="bgc57"
                        size="mini"
                        icon="el-icon-user"
                        @click="openPer"
                      />
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="工艺状态" prop="craftState">
                    <el-select
                      filterable
                      v-model="machiaForm.craftState"
                      size="mini"
                      placeholder="请选择工艺状态"
                    >
                      <el-option label="生产中" :value="1"></el-option>
                      <el-option label="已完成" :value="2"></el-option>
                      <el-option label="流转" :value="3"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item label="作业备注" prop="workTaskRemark">
                    <el-input
                      v-model="machiaForm.workTaskRemark"
                      type="textarea"
                      :rows="3"
                      size="mini"
                      :disabled="allcanDisablle"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row style="margin-top: 10px">
                <el-col :span="24">
                  <el-form-item label="特殊备注" prop="specialRemark">
                    <el-input
                      v-model="machiaForm.specialRemark"
                      type="textarea"
                      :rows="3"
                      size="mini"
                      :disabled="allcanDisablle"
                    />
                  </el-form-item>
                </el-col>
              </el-row>

              <!-- <template v-if="type == '模切'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row :gutter="24">
                  <el-col :span="8">
                    <el-form-item label="刀次" prop="cropCount">
                      <el-input
                        v-model.number="machiaForm.cropCount"
                        placeholder="请填写刀次"
                        :disabled="allcanDisablle"
                        @blur="MQcalculation"
                        size="mini"
                      >
                        <template slot="append">次</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="每切跳距" prop="makeup_SkipDistance">
                      <el-input
                        v-model.number="machiaForm.makeup_SkipDistance"
                        placeholder="请填写每切跳距"
                        disabled
                        size="mini"
                      >
                        <template slot="append">mm</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="总米数" prop="dieCuttingTotalMeters">
                      <el-input
                        v-model.number="machiaForm.dieCuttingTotalMeters"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                </el-row>

                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        multiple
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
              <template v-else-if="type == '检验'">
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <el-row :gutter="24">
                  <el-col :span="8"
                    ><el-form-item label="良品数" prop="goodProductsMeters">
                      <el-input
                        v-model.number="machiaForm.goodProductsMeters"
                        placeholder="请填写良品数"
                        :disabled="allcanDisablle"
                        @blur="JYcalculation"
                        size="mini"
                      >
                        <template slot="append">{{
                          machiaForm.orderProductUnit
                        }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item
                      label="不良品数"
                      prop="defectiveProductsMeters"
                    >
                      <el-input
                        v-model.number="machiaForm.defectiveProductsMeters"
                        placeholder="请填写不良品数"
                        :disabled="allcanDisablle"
                        @blur="JYcalculation"
                        size="mini"
                      >
                        <template slot="append">{{
                          machiaForm.orderProductUnit
                        }}</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="总数量" prop="inspectCount">
                      <el-input
                        v-model.number="machiaForm.examineTotalQuantity"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">枚</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <el-row :gutter="24">
                  <el-col :span="8"
                    ><el-form-item label="总米数" prop="examineTotalMeters">
                      <el-input
                        v-model.number="machiaForm.examineTotalMeters"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item></el-col
                  >
                  <el-col :span="8"
                    ><el-form-item label="不良率" prop="examineDefectiveRate">
                      <el-input
                        v-model.number="machiaForm.examineDefectiveRate"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">%</template></el-input
                      >
                    </el-form-item></el-col
                  >
                </el-row>
                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        multiple
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template> -->
              <!-- 其它 -->
              <template >
                <div class="cTitle">
                  <h3>作业明细</h3>
                </div>
                <template v-if="type == '检验'">
                  <el-row :gutter="24">
                    <el-col :span="8">
                      <el-form-item label="每组枚数" prop="perGroupCount">
                        <el-input
                          v-model.number="machiaForm.perGroupCount"
                          placeholder="请填写每组枚数"
                          :disabled="allcanDisablle"
                          @blur="JYcalculation"
                          size="mini"
                        >
                          <template slot="append">次</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="每组高度" prop="perGroupHeight">
                        <el-input
                          v-model.number="machiaForm.perGroupHeight"
                          :disabled="allcanDisablle"
                          @blur="JYcalculation"
                          placeholder="请填写每切跳距"
                          size="mini"
                        >
                          <template slot="append">mm</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="跳距" prop="skipDistance">
                        <el-input
                          v-model.number="machiaForm.skipDistance"
                          :disabled="allcanDisablle"
                          @blur="JYcalculation"
                          placeholder="请填写跳距"
                          size="mini"
                        >
                          <template slot="append">mm</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="检验枚数" prop="cropCount">
                        <el-input
                          v-model.number="machiaForm.cropCount"
                          :disabled="allcanDisablle"
                          @blur="JYcalculation"
                          placeholder="请填写检验枚数"
                          size="mini"
                        >
                          <template slot="append">mm</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                  </el-row>
                </template>
                <template v-if="type == '模切'">
                  <el-row :gutter="24">
                    <el-col :span="8">
                      <el-form-item label="刀次" prop="cropCount">
                        <el-input
                          v-model.number="machiaForm.cropCount"
                          placeholder="请填写刀次"
                          :disabled="allcanDisablle"
                          @blur="MQcalculation"
                          size="mini"
                        >
                          <template slot="append">次</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="每切跳距" prop="makeup_SkipDistance">
                        <el-input
                          v-model.number="machiaForm.makeup_SkipDistance"
                          :disabled="allcanDisablle"
                          @blur="MQcalculation"
                          placeholder="请填写每切跳距"
                          size="mini"
                        >
                          <template slot="append">mm</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="刀版高度" prop="knifeVersionHieght">
                        <el-input
                          v-model.number="machiaForm.knifeVersionHieght"
                          :disabled="allcanDisablle"
                          @blur="MQcalculation"
                          placeholder="请填写刀版高度"
                          size="mini"
                        >
                          <template slot="append">mm</template></el-input
                        >
                      </el-form-item>
                    </el-col>
                  </el-row>
                </template>
                <el-row :gutter="24">
                  <el-col :span="8">
                    <el-form-item label="总米数" prop="otherTotalMeters">
                      <el-input
                        v-model.number="machiaForm.otherTotalMeters"
                        placeholder="请填写总米数"
                        :disabled="allcanDisablle"
                        @blur="QTcalculation"
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item
                      label="不良品米数"
                      prop="defectiveProductsMeters"
                    >
                      <el-input
                        v-model.number="machiaForm.defectiveProductsMeters"
                        placeholder="请填写不良品米数"
                        :disabled="allcanDisablle"
                        @blur="QTcalculation"
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                  <el-col :span="8">
                    <el-form-item label="良品米数" prop="goodProductsMeters">
                      <el-input
                        v-model.number="machiaForm.goodProductsMeters"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">米</template></el-input
                      >
                    </el-form-item>
                  </el-col>
                </el-row>
                
                <el-row :gutter="24">
                  <el-col :span="8">
                    <el-form-item label="不良率" prop="otherDefectiveRate">
                      <el-input
                        v-model.number="machiaForm.otherDefectiveRate"
                        placeholder="系统自动计算"
                        disabled
                        size="mini"
                      >
                        <template slot="append">%</template></el-input
                      >
                    </el-form-item>
                  </el-col>

                  
                </el-row>
                <div class="cTitle">
                  <h3>异常明细</h3>
                  <div class="operations" v-if="!allcanDisablle">
                    <span @click="addExecp"
                      ><i class="el-icon-circle-plus-outline"></i>添加明细</span
                    >|<span @click="handleDeleteAbnormal"
                      ><i class="el-icon-delete"></i>删除</span
                    >
                  </div>
                </div>

                <el-table
                  :data="machiaForm.exceptionDataList"
                  @selection-change="handleAbnormalChange"
                  border
                  style="width: 100%"
                >
                  <el-table-column type="selection" width="55">
                  </el-table-column>
                  <el-table-column
                    label="卷号"
                    prop="reelNumber"
                    show-overflow-tooltip
                    width="190"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.reelNumber"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开始页码"
                    prop="beginPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.beginPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="结束页码"
                    prop="endPageNo"
                    show-overflow-tooltip
                    width="100"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.endPageNo"
                        placeholder="请输入"
                        type="number"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="异常原因"
                    prop="exceptionReason"
                    show-overflow-tooltip
                    width="230"
                  >
                    <template slot-scope="{ row }">
                      <el-select
                        filterable
                        v-model="row.exceptionReason"
                        placeholder="请选择"
                        multiple
                        size="mini"
                        :disabled="allcanDisablle"
                      >
                        <el-option
                          v-for="item in reasonDataList"
                          :key="item.exceptionCode"
                          :label="item.exceptionName"
                          :value="item.exceptionCode"
                        />
                      </el-select>
                    </template>
                  </el-table-column>

                  <el-table-column
                    label="备注"
                    show-overflow-tooltip
                    min-width="150"
                    prop="exceptionRemark"
                  >
                    <template slot-scope="{ row }">
                      <el-input
                        v-model="row.exceptionRemark"
                        placeholder="请输入"
                        size="mini"
                        :disabled="allcanDisablle"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-col>
            <el-col :span="6" class="formItem fright">
              <el-form-item label="上班班次" prop="indexNumber">
                <el-select
                  v-model="machiaForm.workShiftNo"
                  :disabled="allcanDisablle"
                  placeholder="请选择"
                  size="mini"
                  filterable
                >
                  <el-option
                    v-for="item in bcList"
                    :key="item.code"
                    :label="item.name"
                    :value="item.code"
                  />
                </el-select>
              </el-form-item>
              <el-form-item label="计划工时">
                <el-input
                  v-model="machiaForm.planWorkTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>

              <el-form-item label="标准效率">
                <el-input
                  v-model="machiaForm.standardEfficiency"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">米/小时</template></el-input
                >
              </el-form-item>
              <el-form-item label="开始时间">
                <el-date-picker
                  v-model="machiaForm.workBeginTime"
                  type="datetime"
                  :picker-options="option"
                  placeholder="选择日期"
                  size="mini"
                  disabled
                />
              </el-form-item>
              <el-form-item label="结束时间">
                <el-date-picker
                  v-model="machiaForm.workFinishTime"
                  type="datetime"
                  :picker-options="option"
                  placeholder="选择日期"
                  size="mini"
                  disabled
                />
              </el-form-item>
              <el-form-item label="总工时">
                <el-input
                  v-model="machiaForm.taskUseTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="其他时间">
                <el-input
                  v-model="machiaForm.otherUseTime"
                  placeholder="0"
                  size="mini"
                  :disabled="allcanDisablle"
                  @blur="efficiency"
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="其它备注" class="mb30">
                <el-input
                  v-model="machiaForm.otherRemark"
                  type="textarea"
                  :rows="2"
                  placeholder="请输入其它备注"
                  size="mini"
                  :disabled="allcanDisablle"
                >
                </el-input>
              </el-form-item>

              <el-form-item label="吃饭时间">
                <el-input
                  v-model="machiaForm.dinnertime"
                  placeholder="自动计算"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template>
                </el-input>
              </el-form-item>
              <el-form-item label="实际工时">
                <el-input
                  v-model="machiaForm.actualWorkTime"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append">分钟</template></el-input
                >
              </el-form-item>
              <el-form-item label="实际效率">
                <el-input
                  v-model="machiaForm.workEfficiency"
                  onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
                  placeholder="0"
                  size="mini"
                  disabled
                >
                  <template slot="append" v-if="type == '采集'">枚/套</template>
                  <template slot="append" v-else>米/小时</template></el-input
                >
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" @click="showAddDialog = false">取 消</el-button>
        <el-button size="mini" @click="handleCarSee">查看工艺资料卡</el-button>
        <!-- 新增       -->
        <el-button
          v-if="opsid !== -1"
          :loading="addLoading"
          :disabled="addLoading"
          element-loading-spinner="el-icon-loading"
          type="primary"
          size="mini"
          @click="saveMachina"
        >
          {{ opsid === 0 ? "完成" : "保存" }}</el-button
        >
      </div>
    </el-dialog>
    <!-- 人员寻找弹框   -->
    <per-redio-dialog
      :per-visible.sync="isperShow"
      @getEmployee="getEmployee"
    />

    <!-- 作废 -->
    <el-dialog
      title="作废原因"
      :visible.sync="voidDialog"
      :close-on-click-modal="false"
      custom-class="bodyNoPadDialog"
      width="50%"
    >
      <el-form
        ref="viodForm"
        :model="viodForm"
        :rules="viodRules"
        hide-required-asterisk
        label-width="auto"
      >
        <div class="p16">
          <el-form-item prop="reason" style="margin-bottom: 0">
            <el-input
              v-model="viodForm.reason"
              type="textarea"
              :rows="4"
              placeholder="请输入作废原因"
            />
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" @click="voidDialog = false">取 消</el-button>
        <!-- 新增       -->
        <el-button
          :loading="addLoading"
          :disabled="addLoading"
          element-loading-spinner="el-icon-loading"
          type="primary"
          size="mini"
          @click="handleViodSave"
        >
          保存</el-button
        >
      </div>
    </el-dialog>

    <el-dialog
      title="技术资料卡"
      :visible.sync="pupState"
      :close-on-click-modal="false"
      custom-class="comDialog"
      width="80%"
    >
      <div class="dialogDody">
        <el-form
          ref="personnelForm"
          :model="cartFormData"
          label-width="80px"
          :disabled="disabled"
          class="dialogForm"
        >
          <div class="item">
            <div class="item-title">
              <h3>基础讯息</h3>
            </div>
            <div class="item-content list list_3">
              <el-form-item label="产品名称" prop="">
                <el-input
                  :value="machiaForm.orderProductName"
                  placeholder="自动获取"
                  size="small"
                  disabled
                />
              </el-form-item>
              <el-form-item label="产品编码" prop="">
                <el-input
                  :value="cartFormData.baseData.productNumber"
                  placeholder="自动获取"
                  size="small"
                  disabled
                />
              </el-form-item>
              <el-form-item label="客户名称" prop="">
                <el-input
                  :value="cartFormData.baseData.customerName"
                  placeholder="自动获取"
                  size="small"
                  disabled
                />
              </el-form-item>
              <el-form-item label="工艺名称" prop="">
                <el-input
                  v-model="machiaForm.produceCraftName"
                  size="mini"
                  disabled
                />
              </el-form-item>
              <el-form-item label="版筒轮号" prop="">
                <el-input
                  v-model="cartFormData.baseData.sBanTongLunHao"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="印刷跳距" prop="">
                <el-input
                  v-model="cartFormData.baseData.sYinShuaTiaoJu"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="模切跳距" prop="">
                <el-input
                  v-model="cartFormData.baseData.sMoQieTiaoJu"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="虚刀" prop="">
                <el-input
                  v-model="cartFormData.baseData.sXuDao"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="复合" prop="">
                <el-input
                  v-model="cartFormData.baseData.sFuHe"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="杀胶" prop="">
                <el-input
                  v-model="cartFormData.baseData.sShaJiao"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="胶面印刷" prop="">
                <el-input
                  v-model="cartFormData.baseData.sJiaoMianYinShua"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="烫金" prop="">
                <el-select
                  v-model="cartFormData.baseData.sTangJin"
                  filterable
                  placeholder="请选择"
                  size="small"
                >
                  <el-option label="热烫" value="热烫" />
                  <el-option label="冷烫" value="冷烫" />
                </el-select>
              </el-form-item>
              <el-form-item label="覆膜" prop="">
                <el-input
                  v-model="cartFormData.baseData.sFuMo"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="光油" prop="">
                <el-input
                  v-model="cartFormData.baseData.sGuangYou"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
              <el-form-item label="喷码" prop="">
                <el-input
                  v-model="cartFormData.baseData.sPenMa"
                  placeholder="请输入"
                  size="small"
                />
              </el-form-item>
            </div>
          </div>
          <div class="item">
            <div class="item-title">
              <h3>基础讯息</h3>
            </div>
            <div class="item-content">
              <el-table
                :data="cartFormData.machineData"
                border
                style="width: 100%"
              >
                <el-table-column type="index" label="序号" width="50" />
                <el-table-column prop="prop1" align="left" label="适用机台">
                  <template slot-scope="scope">
                    <el-select
                      v-model="scope.row.machineCode"
                      placeholder="请选择"
                      size="small"
                      :disabled="disabled"
                      filterable
                      @change="
                        handleMachineChange(scope.row, scope.$index, $event)
                      "
                    >
                      <el-option
                        v-for="item in allMaterielClass"
                        :key="item.machineCode"
                        :label="item.machineName"
                        :value="item.machineCode"
                      >
                      </el-option>
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="prop2" align="left" label="预调机时间">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.pretreatmentTime"
                      :disabled="disabled"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column prop="prop3" align="left" label="建议速度">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.recommendedSpeed"
                      :disabled="disabled"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column prop="prop4" align="left" label="出卷张力">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.coilingTension"
                      :disabled="disabled"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column prop="prop5" align="left" label="收卷张力">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.windingTension"
                      :disabled="disabled"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column prop="prop6" align="left" label="覆卷张力">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.coilTension"
                      :disabled="disabled"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="100px"
                  fixed="right"
                  align="center"
                  v-if="!disabled"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="handleCopy(scope.row, scope.$index, 1)"
                      v-if="cartFormData.machineData.length - 1 != scope.$index"
                    >
                      <p>复制</p>
                    </el-button>
                    <el-button
                      type="text"
                      @click="handleDelete(scope.row, scope.$index, 1)"
                      v-if="cartFormData.machineData.length - 1 != scope.$index"
                    >
                      <p>删除</p>
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="item">
            <div class="item-title">
              <h3>材料信息</h3>
            </div>
            <div class="item-content">
              <el-table
                :data="cartFormData.materialData"
                border
                style="width: 100%"
              >
                <el-table-column type="index" label="序号" width="50" />
                <el-table-column
                  prop="specificationCode"
                  width="150"
                  align="center"
                  label="规格编号"
                >
                  <template slot-scope="scope">
                    {{ scope.row.specificationCode || "--" }}
                  </template>
                </el-table-column>
                <el-table-column
                  prop="goodsType"
                  width="100"
                  align="center"
                  label="物料类型"
                >
                  <template slot-scope="scope">
                    {{ scope.row.goodsType || "--" }}
                  </template>
                </el-table-column>
                <el-table-column
                  prop="school"
                  width="250"
                  align="center"
                  label="供应商"
                >
                  <template slot-scope="scope">
                    <el-select
                      filterable
                      v-model="scope.row.supplierCode"
                      placeholder="请选择供应商"
                      disabled
                      size="small"
                      @change="supplierChange(scope.row, $event)"
                    >
                      <el-option
                        :key="item.supplierID"
                        :label="item.supplierName"
                        :value="item.supplierCode"
                        v-for="(item, index) in allSupliers"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column prop="school" align="center" label="物料名称">
                  <template slot-scope="scope">
                    <el-select
                      filterable
                      v-model="scope.row.goodsCode"
                      placeholder="请选择物料"
                      disabled
                      @change="
                        handleMaterialNameChange(
                          scope.row,
                          scope.$index,
                          $event
                        )
                      "
                      size="small"
                    >
                      <el-option
                        :label="item.goodsName"
                        :value="item.goodsCode"
                        v-for="(item, index) in scope.row.materialList"
                        :key="index"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="specificationCode"
                  align="center"
                  label="规格型号"
                >
                  <template slot-scope="scope">
                    <el-select
                      filterable
                      v-model="scope.row.specificationCode"
                      placeholder="请选择规格型号"
                      disabled
                      size="small"
                    >
                      <el-option
                        :label="item.specificationName"
                        :value="item.specificationCode"
                        v-for="(item, index) in scope.row
                          .goodsSpecificationList"
                        :key="index"
                      />
                    </el-select>
                  </template>
                </el-table-column>
                <!-- <el-table-column
                  label="操作"
                  width="100px"
                  fixed="right"
                  align="center"
                  v-if="!disabled"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="handleCopy(scope.row, scope.$index, 2)"
                      v-if="
                        cartFormData.materialData.length - 1 != scope.$index
                      "
                    >
                      <p>复制</p>
                    </el-button>
                    <el-button
                      type="text"
                      @click="handleDelete(scope.row, scope.$index, 2)"
                      v-if="
                        cartFormData.materialData.length - 1 != scope.$index
                      "
                    >
                      <p>删除</p>
                    </el-button>
                  </template>
                </el-table-column> -->
              </el-table>
            </div>
          </div>
          <div class="item">
            <div class="item-title">
              <h3>油墨配方</h3>
            </div>
            <div class="item-content">
              <el-table :data="cartFormData.inkData" border style="width: 100%">
                <el-table-column type="index" label="序号" width="50" />
                <el-table-column
                  prop="prop1"
                  align="left"
                  label="颜色名称"
                  width="120"
                >
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.colorName"
                      :disabled="disabled"
                      @blur="handleAddRow(scope.row, scope.$index)"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  prop="prop2"
                  align="left"
                  label="油墨代号"
                  width="120"
                >
                  <template slot-scope="scope">
                    <el-input
                      :disabled="disabled"
                      v-model="scope.row.inkCodeName"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  prop="prop4"
                  align="left"
                  label="油墨配比"
                  min-width="300"
                >
                  <template slot-scope="scope">
                    <el-input
                      :disabled="disabled"
                      v-model="scope.row.inkRatio"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  prop="prop7"
                  align="left"
                  label="网纹辊线数"
                  width="120"
                >
                  <template slot-scope="scope">
                    <el-input
                      :disabled="disabled"
                      v-model="scope.row.aniloxRollsQuantity"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  prop="prop8"
                  align="left"
                  label="目数"
                  width="120"
                >
                  <template slot-scope="scope">
                    <el-input
                      :disabled="disabled"
                      v-model="scope.row.meshQuantity"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  prop="prop5"
                  width="120"
                  align="left"
                  label="供应商"
                >
                  <template slot-scope="scope">
                    <el-input
                      :disabled="disabled"
                      v-model="scope.row.supplier"
                      placeholder="请输入"
                      size="small"
                    />
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="100px"
                  fixed="right"
                  align="center"
                  v-if="!disabled"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      @click="handleCopy(scope.row, scope.$index, 3)"
                      v-if="cartFormData.inkData.length - 1 != scope.$index"
                    >
                      <p>复制</p>
                    </el-button>
                    <el-button
                      type="text"
                      @click="handleDelete(scope.row, scope.$index, 3)"
                      v-if="cartFormData.inkData.length - 1 != scope.$index"
                    >
                      <p>删除</p>
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
          <div class="item">
            <div class="item-title">
              <h3>客户品质要求</h3>
            </div>
            <div class="item-content">
              <el-checkbox
                v-model="cartFormData.baseData.scanBarcode"
                label="条码扫读"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.testInkability"
                label="着墨性测试"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.testAbrasion"
                label="耐磨测试"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.testTemperature"
                label="高低温测试"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.testAlcohol"
                label="耐酒精测试"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.testStickiness"
                label="粘性测试"
              ></el-checkbox>
              <el-checkbox
                v-model="cartFormData.baseData.other"
                label="其它"
              ></el-checkbox>
            </div>
          </div>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="flex flex_between">
          <div></div>
          <div>
            <el-button size="mini" @click="pupState = false">
              <p>取 消</p>
            </el-button>
            <el-button size="mini" type="primary" @click="handleIsLocked">
              <p v-if="disabled">解锁</p>
              <p v-else>锁定</p>
            </el-button>
            <el-button
              element-loading-spinner="el-icon-loading"
              type="primary"
              size="mini"
              v-if="!disabled"
              @click="handleCarSave"
            >
              <p>保 存</p>
            </el-button>
          </div>
        </div>
      </span>
    </el-dialog>

    <!--   选择物料  -->
    <SelectMateriaList
      ref="materiaList"
      :per-visible.sync="showMateria"
      @getMateriListData="refuseListsMateriAll"
    />
  </div>
</template>
<script>
import { arraySort } from "@/utils";
import HeadSeting from "@/components/HeadSeting";
import Pagination from "@/components/Pagination";
import perRedioDialog from "@/components/perDialogRedio";
import SelectMateriaList from "@/components/selectMaterial";
import naTable from "@/components/naTable";
import pinyin from "js-pinyin";
import { mapGetters } from "vuex";
import screec from "@/components/screen";
import picking from "./components/picking";
import returnMaterial from "./components/returnMaterial";
import { number } from "yargs";

export default {
  name: "code",
  components: {
    Pagination,
    HeadSeting,
    screec,
    picking,
    returnMaterial,
    perRedioDialog,
    SelectMateriaList,
    naTable,
  },
  computed: {
    ...mapGetters(["name", "userInfo"]),
  },
  data() {
    const validatePassword = (rule, value, callback) => {
      if (value.length < 6) {
        callback(new Error("密码长度不正确"));
      } else {
        callback();
      }
    };
    return {
      form: {
        produceTaskBillNo: "", //订单编号
        deviceCraftCode: "", //机台工艺编号
        craftTaskNo: "",
      },

      loginForm: {
        loginAccount: "", //账号
        loginPassWord: "", //密码
      },

      loginRules: {
        loginAccount: [
          {
            required: true,
            trigger: "blur",
            message: "请输入账号",
          },
        ],
        loginPassWord: [
          {
            required: true,
            trigger: "blur",
            validator: validatePassword,
          },
        ],
      },

      allMaterielClass: [],
      allSupliers: [],
      search: {
        pageIndex: 1,
        pageSize: 30,
        likeWords: "",
        QueryDataBaseFiled: "",
        employeeCode: "",
        isAllEmployee: 1, //1全部
        isDisabled: false,
      },

      finishTime: "",
      total: 0,
      dataLists: [],
      tableHead: [],
      tableHeight: null, // 表格最大高度
      tableScreenHead: [],
      bcList: [],
      workmanshipList: [], //工艺列表数据
      workmanshipModel: false, //生产工艺弹窗

      searchLoading: false,
      loginModel: false,

      isperShow: false,
      addLoading: false,
      rowID: 0,
      selectArr: [],
      showAddDialog: false,
      machiaForm: [],
      canDisablle: false,
      allcanDisablle: false,
      assisList: [],
      opsid: 0,
      ExceptionTypeList: [],
      isShadeShow: false,
      reasonVisibleall: false,
      addLableLoading: false,
      Matitle: "",
      showOrder: false, // 订单弹窗
      showCraft: false, // 选择工艺
      showMateria: false, // 选择物料
      showPicking: false, //生产领料
      showMaterial: false, //生产退料
      orderNo: "", // 订单号
      loading: null,
      conIndex: 0,
      tabsIndex: 0, // 右侧tabs切换索引
      tagIndex: 0, // 当前标签索引
      colorOps: "add", // 印刷颜色当前操作
      colorEditIndex: null, // 印刷颜色修改的索引
      dataLoading: false, // 订单详情数据加载
      orderLoading: false, // 订单保存加载效果
      listLoading: false,
      isAddColor: false, // 印刷颜色新增弹框是否打开
      reasonDataList: [],
      materiaChecked: [], //辅料明细选中数据
      abnormalChecked: [], //异常明细选中数据
      pageChecked: [], //页码明细选中数据
      machineState: "",
      // 设置时间控件小于当前日期不能选择
      option: {
        disabledDate: (time) => {
          return time.getTime() < Date.now() - 1 * 24 * 3600 * 1000;
        },
      },
      selectDD: {},
      productFrom: {
        baseData: {},
        packageData: {},
        orderBaseData: {},
        productData: {},
      },
      viodForm: {
        workTaskID: "",
        reason: "", //作废原因
      },
      viodRules: {
        reason: [
          {
            required: true,
            message: "请输入作废原因",
            trigger: "blur",
          },
        ],
      },
      voidDialog: false, //作废弹出层状态
      isDisable: false, // 是否禁用输入框
      stopVisible: false,
      reasonVisible: false,
      typeStatus: 0,
      equipment: "",
      type: "",
      index: 0,
      indexPage: 0,
      productList: [],
      rulesFrom: {
        craftState: [
          {
            required: true,
            message: "请选择工艺状态",
            trigger: "change",
          },
        ],
        equipmentCode: [
          {
            required: false,
            message: "请选择生产设备",
            trigger: "change",
          },
        ],
      },
      rules: {
        produceTaskBillNo: [
          {
            required: true,
            message: "请输入生产单号",
            trigger: ["change", "blur"],
          },
        ],
        deviceCraftCode: [
          {
            required: true,
            message: "请输入机台工艺编码",
            trigger: ["change", "blur"],
          },
        ],
      },

      craftList: [], //工艺列表数据
      rowData: {},
      form: {},
      disabled: true,
      pupState: false,
      cartFormData: {
        baseData: {
          productTechniqueCardID: 0,
          productTechniqueCardCode: "",
          productTechniqueCode: "",
          craftCode: "",
          deviceCode: "",
          productCode: "",
          sBanTongLunHao: "",
          sYinShuaTiaoJu: "",
          sMoQieTiaoJu: "",
          sXuDao: "",
          sFuHe: "",
          sJiaoMianYinShua: "",
          sTangJin: "",
          sFuMo: "",
          sGuangYou: "",
          sPenMa: "",
          scanBarcode: true,
          testInkability: true,
          testAbrasion: true,
          testTemperature: true,
          testAlcohol: true,
          testStickiness: true,
          other: true,
        },
        machineData: [
          {
            productTechniqueCardMachineID: 0,
            productTechniqueCardMachineCode: "",
            productTechniqueCardCode: "",
            machineCode: "",
            pretreatmentTime: "",
            recommendedSpeed: "",
            coilingTension: "",
            windingTension: "",
            coilTension: "",
          },
        ],
        materialData: [
          {
            productTechniqueCardMaterialID: 0,
            productTechniqueCardMaterialCode: "",
            productTechniqueCardCode: "",
            goodsCode: "",
            specificationCode: "",
            supplierCode: "",
            thickness: "",
          },
        ],
        inkData: [
          {
            productTechniqueCardInkID: 0,
            productTechniqueCardInkCode: "",
            productTechniqueCardCode: "",
            colorName: "",
            inkCodeName: "",
            inkRatio: "",
            aniloxRollsQuantity: "",
            meshQuantity: "",
            supplier: "",
          },
        ],
      },

      tableData: {
        headId: "head", //表头列显隐组件所需ID-避免多个页面id重复问题
        tableId: "workTaskID", //表格列表key,也就是一条数据的唯一标识
        senior: false, //高级搜索是否显示
        disableWord: "", //是否禁用显示的字段
        disableStatus: "", //判断未禁用的状态值
        addTitle: "", //新建按钮名称-为''则不显示，为undefine则为新建
        addPermission: "", //新建按钮权限
        voidWord: "isDisabled", //需要查询作废的字段
        otherCheckbox: true,
        otherCheckboxWord: "isAllEmployee",
        statusList: [], //状态筛选条件列表
        statusWord: "", //状态筛选的字段
        refresh: true, //刷新按钮
        //表格按钮
        operationBtn: [
          {
            title: "查看", //按钮名称
            methodsName: "handleSeeClick", //按钮绑定方法的字段
          },
          {
            title: "修改",
            methodsName: "handleUpdata",
            hideCondition: {
              //按钮显隐条件
              prop: "isDisabled", //控制显隐的状态字段
              show: [
                //有哪些状态可以使用-值必须跟状态的类型保持一致
                0,
              ],
            },
          },
          {
            title: "作废",
            methodsName: "handleDone",
            isShowCheckbox: true,
            hideCondition: {
              //按钮显隐条件
              prop: "isDisabled", //控制显隐的状态字段
              show: [
                //有哪些状态可以使用-值必须跟状态的类型保持一致
                0,
              ],
              except: "", //除了某个状态其他都可以使用
            },
          },
          {
            title: "查看工单", //按钮名称
            methodsName: "handleSeeBill", //按钮绑定方法的字段
          },
          {
            title: "打印合格证", //按钮名称
            methodsName: "handleDownload", //按钮绑定方法的字段
          },
        ],
        //表格内容
        tbody: [],
        //表格表头
        thead: [],
      },
    };
  },
  created() {
    // 基础数据表格得表头
    this.getTableHead();

    this.getCraftList();

    //获取班次
    this.getBC();

    this.getWorkExceptionTypeDataList();
  },
  mounted() {
    this.$refs.produceTaskBillNo.focus();
  },
  methods: {
    //登录
    handleLogin() {
      this.$refs.loginForm.validate((valid) => {
        if (valid) {
          this.loading = true;
          this.$store
            .dispatch("user/login", this.loginForm)
            .then(() => {
              // this.$router.push({ path: '/scanning/code' })
              location.reload();
              // location.reload(true)
              this.loading = false;
            })
            .catch(() => {
              this.loading = false;
            });
        } else {
          return false;
        }
      });
    },

    //下载合格证
    handleDownload(row) {
      let parmas = {
        templateTypeCode: "", //	模板类型编号
        customerCode: row.customerCode,
        condition: {
          ProduceTaskBillNo: row.produceTaskBillNo,
        }, //查询条件
      };
      if (row.productStyle == 2) {
        parmas.templateTypeCode = "MBLX0007";
      } else {
        parmas.templateTypeCode = "MBLX0008";
      }
      this.$api.system.DownLoadTemplate(parmas).then((res) => {
        window.open(res);
      });
    },

    // 获取供应商
    getSupplier() {
      this.$api.mater.GetAllSuppliers().then((res) => {
        this.allSupliers = res;
      });
    },

    //供应商选择事件
    supplierChange(row, val) {
      row.stockGoodsCode = "";
      this.$set(row, "materialList", []);
      this.$set(row, "goodsSpecificationList", []);
      row.goodsType = "";
      this.$api.mater
        .GetGoodsSpecificationBySupplierCode({
          queryBy: 0,
          queryValue: val,
        })
        .then((res) => {
          this.$set(row, "materialList", res);
          console.log(row);
          this.$forceUpdate();
        });
    },

    //复制
    handleCopy(row, index, type) {
      if (type == 1) {
        this.cartFormData.machineData.splice(
          index,
          0,
          JSON.parse(JSON.stringify(row))
        );
      } else if (type == 2) {
        this.cartFormData.materialData.splice(
          index,
          0,
          JSON.parse(JSON.stringify(row))
        );
      } else if (type == 3) {
        this.cartFormData.inkData.splice(
          index,
          0,
          JSON.parse(JSON.stringify(row))
        );
      }
    },

    //删除
    handleDelete(row, index, type) {
      if (type == 1) {
        this.cartFormData.machineData.splice(index, 1);
      } else if (type == 2) {
        this.cartFormData.materialData.splice(index, 1);
      } else if (type == 3) {
        this.cartFormData.inkData.splice(index, 1);
      }
    },

    //物料下拉选择事件
    handleMaterialNameChange(row, index, e) {
      if (index == this.cartFormData.materialData.length - 1) {
        this.cartFormData.materialData.push({
          productTechniqueCardMaterialID: 0,
          productTechniqueCardMaterialCode: "",
          productTechniqueCardCode: "",
          goodsCode: "",
          specificationCode: "",
          supplierCode: "",
          thickness: "",
        });
      }
      row.specificationCode = "";
      row.materialList.forEach((item, i) => {
        if (item.goodsCode == e) {
          row.goodsType = item.goodsType;
          this.$set(row, "goodsSpecificationList", item.goodsSpecificationList);
        }
      });
    },

    //锁定/解锁
    handleIsLocked() {
      let obj = {
        productTechniqueCardCode:
          this.cartFormData.baseData.productTechniqueCardCode,
        isLocked: this.disabled ? 0 : 1,
      };
      this.$api.business.UpdateProductTechniqueCardIsLocked(obj).then(() => {
        this.$message.success("保存成功");
        this.pupState = false;
      });
    },

    //资料卡保存
    handleCarSave() {
      this.cartFormData.machineData.pop();
      this.cartFormData.materialData.pop();
      this.cartFormData.inkData.pop();
      this.$api.business
        .UpdateProductTechniqueCard(this.cartFormData)
        .then((res) => {
          this.$message.success("保存成功");
          this.pupState = false;
        });
    },

    //获取工艺列表
    getCraftList() {
      this.$api.business
        .GetMatchProductCrafts({ likeWords: "" })
        .then((res) => {
          this.craftList = res;
          if (this.craftList.length > 0) {
            this.craftList.forEach((item) => {
              item.label = item.name;
              item.value = item.deviceCode;
            });
          }
        });
    },

    // 获取所有设备
    getMaterielClass() {
      this.$api.product
        .GetMatchProductDevices({
          likeWords: "",
          machineState: 1,
        })
        .then((res) => {
          this.allMaterielClass = res;
        });
    },

    //查看工艺资料卡
    handleCarSee() {
      this.getMaterielClass();
      this.getSupplier();
      this.cartFormData.baseData.productTechniqueCode =
        this.machiaForm.productTechniqueCode;
      this.$api.business
        .GetProductTechniqueCardDetails({
          productTechniqueCode: this.machiaForm.productTechniqueCode,
        })
        .then((res) => {
          this.cartFormData = res;
          if (this.cartFormData.materialData.length > 0) {
            this.cartFormData.materialData.forEach((item) => {
              this.$api.mater
                .GetGoodsSpecificationBySupplierCode({
                  queryBy: 0,
                  queryValue: item.supplierCode,
                })
                .then((data) => {
                  item.priceUnit = item.goodsUnit;
                  this.$set(item, "materialList", data);
                  item.materialList.forEach((k) => {
                    if (item.goodsCode == k.goodsCode) {
                      this.$set(
                        item,
                        "goodsSpecificationList",
                        k.goodsSpecificationList
                      );
                      item.goodsType = k.goodsType;
                      item.priceUnit = k.goodsUnit;
                    }
                  });
                });
            });
          }
          this.disabled =
            this.cartFormData.baseData.isLocked == 0 ? false : true;
          if (!this.disabled) {
            this.cartFormData.machineData.push({
              productTechniqueCardMachineID: 0,
              productTechniqueCardMachineCode: "",
              productTechniqueCardCode: "",
              machineCode: "",
              pretreatmentTime: "",
              recommendedSpeed: "",
              coilingTension: "",
              windingTension: "",
              coilTension: "",
            });
            // this.cartFormData.materialData.push({
            //   productTechniqueCardMaterialID: 0,
            //   productTechniqueCardMaterialCode: "",
            //   productTechniqueCardCode: "",
            //   goodsCode: "",
            //   specificationCode: "",
            //   supplierCode: "",
            //   thickness: "",
            // });
            this.cartFormData.inkData.push({
              productTechniqueCardInkID: 0,
              productTechniqueCardInkCode: "",
              productTechniqueCardCode: "",
              colorName: "",
              inkCodeName: "",
              inkRatio: "",
              aniloxRollsQuantity: "",
              meshQuantity: "",
              supplier: "",
            });
          }
          this.pupState = true;
        });
    },

    //机台选择事件
    handleMachineChange(row, index, e) {
      if (index == this.cartFormData.machineData.length - 1) {
        this.cartFormData.machineData.push({
          productTechniqueCardMachineID: 0,
          productTechniqueCardMachineCode: "",
          productTechniqueCardCode: "",
          machineCode: "",
          pretreatmentTime: "",
          recommendedSpeed: "",
          coilingTension: "",
          windingTension: "",
          coilTension: "",
        });
      }
    },

    handleAddRow(row, index) {
      if (index == this.cartFormData.inkData.length - 1) {
        this.cartFormData.inkData.push({
          productTechniqueCardInkID: 0,
          productTechniqueCardInkCode: "",
          productTechniqueCardCode: "",
          colorName: "",
          inkCodeName: "",
          inkRatio: "",
          aniloxRollsQuantity: "",
          meshQuantity: "",
          supplier: "",
        });
      }
    },

    //时间格式化
    dateFtt(fmt, date) {
      //author: meizz
      var o = {
        "M+": date.getMonth() + 1, //月份
        "d+": date.getDate(), //日
        "h+": date.getHours(), //小时
        "m+": date.getMinutes(), //分
        "s+": date.getSeconds(), //秒
        "q+": Math.floor((date.getMonth() + 3) / 3), //季度
        S: date.getMilliseconds(), //毫秒
      };
      if (/(y+)/.test(fmt))
        fmt = fmt.replace(
          RegExp.$1,
          (date.getFullYear() + "").substr(4 - RegExp.$1.length)
        );
      for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt))
          fmt = fmt.replace(
            RegExp.$1,
            RegExp.$1.length == 1
              ? o[k]
              : ("00" + o[k]).substr(("" + o[k]).length)
          );
      return fmt;
    },

    //点击显示作废
    handleisDisabledChange() {
      this.search.pageIndex = 1;
      this.getAllMaterils();
    },

    //点击列表工艺
    handleItem(row, index) {
      console.log(row);
      this.listLoading = true;
      if (row.craftTaskState == 2) {
        this.$message.error("该工艺已完成，不可在建任务单");
        this.listLoading = false;
        return;
      }

      //判断上一个
      if (index > 0) {
        let previous = this.workmanshipList[index - 1].craftTaskState;
        if (row.craftName == "检验") {
          if (previous == 0) { 
            this.$message.error("上一流程还未开始，请耐心等待");
            this.listLoading = false;
            return;
          } else {
            //this.userInfo.employeeCode
            this.$api.system
              .GetProduceCraftWorkTaskDetailByEmployeeCode({
                employeeCode: this.userInfo.employeeCode,
              })
              .then((res) => {
                if (res) {
                  this.$confirm("您还有未完成的检验作业，请先完成?", "提示", {
                    confirmButtonText: "去完成",
                    cancelButtonText: "取消",
                    type: "warning",
                  })
                    .then((data) => {
                      this.workmanshipModel = false;
                      this.opsid = 2;
                      this.rowID = res.baseData.workTaskID;
                      this.Matitle = "修改生产作业";
                      this.canDisablle = true;
                      this.allcanDisablle = false;
                      this.equipment = res.equipmentDataList;
                      console.log(this.machiaForm.equipmentCode);
                      this.assisList = res.assistantList;
                      this.assisList.forEach((e) => {
                        e.employeeCode = e.employeeNo;
                      });
                      this.machiaForm = res.baseData;
                      if (this.machiaForm.craftState == 1) {
                        this.machiaForm.craftState = "";
                      }
                      this.reasonDataList = res.exceptionReasonList;
                      this.machiaForm.exceptionDataList = res.exceptionDataList;
                      this.machiaForm.mainMaterialDataList =
                        res.mainMaterialDataList;
                      this.machiaForm.ingredientsDataList =
                        res.ingredientsDataList;
                      this.machiaForm.pageDetailDataList =
                        res.pageDetailDataList;
                      if (this.equipment.length > 1) {
                        this.rulesFrom.equipmentCode[0].required = true;
                      } else if (this.equipment.length == 1) {
                        this.machiaForm.equipmentCode =
                          this.equipment[0].equipmentNo;
                      } else {
                        this.rulesFrom.equipmentCode[0].required = false;
                      }
                      this.machiaForm.exceptionDataList.forEach((item) => {
                        item.beginPageNo = Number(item.beginPageNo);
                        item.endPageNo = Number(item.endPageNo);
                        item.exceptionReason = item.exceptionReason.split(",");
                      });
                      this.machiaForm.workShiftNo = this.bcList[0].code;
                      this.machiaForm.produceUseTime = this.timeFn(
                        this.machiaForm.workBeginTime,
                        this.machiaForm.workFinishTime
                      );
                      let time = new Date();
                      if (!this.machiaForm.workFinishTime) {
                        this.machiaForm.workFinishTime = this.dateFtt(
                          "yyyy-MM-dd hh:mm:ss",
                          time
                        );
                      }
                      this.finishTime = JSON.parse(
                        JSON.stringify(this.machiaForm.workFinishTime)
                      );
                      // this.machiaForm.workShiftNo = 'BC0019'
                      var date3 =
                        new Date(this.machiaForm.workFinishTime).getTime() -
                        new Date(this.machiaForm.workBeginTime).getTime();
                      var subMinutes = Math.floor(date3 / (60 * 1000)); //获取总共的分钟差
                      this.finishTime = JSON.parse(
                        JSON.stringify(this.machiaForm.workFinishTime)
                      );
                      //总工时
                      this.machiaForm.taskUseTime = subMinutes;
                      //吃饭时间
                      this.machiaForm.dinnertime = this.dinnertimeCalculation(
                        this.machiaForm.workBeginTime,
                        this.machiaForm.workFinishTime
                      );
                      this.calculationEfficiency();
                      this.showAddDialog = true;
                    })
                    .catch(() => {});
                } else {
                  this.createScanningWork(row);
                }
              });
            this.listLoading = false;
            return;
          }
        } else {
          if (previous != 2 && previous != 3) {
            this.$message.error("上一工序还没流转或已完成");
            this.listLoading = false;
            return;
          }
        }
      }
      this.createScanningWork(row);
    },

    createScanningWork(row) {
      this.form.deviceCraftCode = row.machineCraftCode;
      this.form.craftTaskNo = row.craftTaskNo;
      this.$api.system
        .AddScanningWork(this.form)
        .then((res) => {
          this.$message.success("创建成功");
          this.form = {
            produceTaskBillNo: "", //订单编号
            deviceCraftCode: "", //机台工艺编号
          };
          this.$refs.produceTaskBillNo.focus();
          this.$nextTick(() => {
            this.$refs["materForm"].clearValidate();
          });
          this.getAllMaterils();
          this.workmanshipModel = false;
        })
        .catch((err) => {
          this.form.deviceCraftCode = ""; //机台工艺编号
        });
    },

    //点击确定
    handleSave() {
      this.$refs.materForm.validate((valid) => {
        if (valid) {
          this.$api.system
            .GetProduceCraftListByProduceTaskBillNo({
              produceTaskBillNo: this.form.produceTaskBillNo,
            })
            .then((res) => {
              this.workmanshipList = res;
              this.workmanshipModel = true;
              this.listLoading = false;
            });
        }
      });
    },

    //计算吃饭时间
    dinnertimeCalculation(startTime, endTime) {
      let beginTime = startTime.split(" ")[1];
      let finishTime = startTime.split(" ")[1];
      let startTimeDate = startTime.split(" ")[0];
      let endTimeDate = endTime.split(" ")[0];
      var startTime = new Date(startTime);
      var endTime = new Date(endTime);
      var totalMinutes = 0;
      var dayOfMinutes = 0;
      var timeGroup = [
        { startTime: "12:00", endTime: "12:30" },
        { startTime: "17:00", endTime: "17:30" },
        { startTime: "22:00", endTime: "22:30" },
      ];
      for (let index = 0; index < timeGroup.length; index++) {
        const element = timeGroup[index];
        var startArr = element.startTime.split(":");
        var endArr = element.endTime.split(":");
        var hours = parseInt(startArr[0]);
        var minutes = parseInt(endArr[1]);
        dayOfMinutes +=
          (parseInt(endArr[0]) - hours) * 60 + minutes - parseInt(startArr[1]);
        if (startTimeDate == endTimeDate) {
          if (
            startTime.getHours() > hours &&
            startTime.getMinutes() > startArr[1]
          ) {
            continue;
          } else if (
            (startTime.getHours() < hours && endTime.getHours() >= hours) ||
            (startTime.getHours() == hours && startArr[1] < minutes)
          ) {
            if (
              startTime.getMinutes() > minutes &&
              startTime.getHours() > hours
            ) {
              continue;
            }
            if (
              endTime.getHours() == hours &&
              endTime.getMinutes() <= minutes
            ) {
              totalMinutes += endTime.getMinutes() - startArr[1];
            } else if (
              startTime.getHours() == hours &&
              startTime.getMinutes() <= minutes
            ) {
              totalMinutes += minutes - startTime.getMinutes();
            } else if (
              startTime.getHours() == hours &&
              startTime.getMinutes() > minutes
            ) {
              continue;
            } else {
              totalMinutes += minutes;
            }
          }
        } else {
          if (startTime.getHours() <= hours) {
            if (startTime.getHours() < hours) {
              totalMinutes += minutes;
            } else if (
              startTime.getHours() == hours &&
              startTime.getMinutes() <= minutes
            ) {
              totalMinutes += minutes - startTime.getMinutes();
            }
          }
          if (endTime.getHours() >= hours) {
            if (
              endTime.getHours() > hours ||
              (endTime.getHours() == hours && endTime.getMinutes() >= minutes)
            ) {
              totalMinutes += minutes;
            } else if (
              endTime.getHours() == hours &&
              endTime.getMinutes() < minutes
            ) {
              totalMinutes += endTime.getMinutes();
            }
          }
        }
      }
      var days =
        Math.abs(new Date(endTimeDate) - new Date(startTimeDate)) /
          1000 /
          60 /
          60 /
          24 -
        1;
      if (days > 0) {
        totalMinutes += days * dayOfMinutes;
      }
      return totalMinutes;
    },

    //保存生产作业
    saveMachina() {
      const _d = [];
      this.assisList.forEach((e) => {
        _d.push(e.employeeCode);
      });
      this.machiaForm.assistantList = _d;
      this.machiaForm.workFinishTime = JSON.parse(
        JSON.stringify(this.finishTime)
      );
      this.$refs.machiaForm.validate((valid) => {
        if (valid) {
          if (this.opsid === 0) {
            let state = true;
            this.machiaForm.exceptionDataList.forEach((item) => {
              if (!item.reelNumber) {
                state = false;
              }
              item.beginPageNo = Number(item.beginPageNo);
              item.endPageNo = Number(item.endPageNo);
              if (item.exceptionReason) {
                item.exceptionReason = item.exceptionReason.join(",");
              }
            });
            debugger;
            if (!state) {
              this.$message.warning("请填写异常明细");
              return;
            }
            this.$api.product
              .UpdateProduceCraftWorkTask(this.machiaForm)
              .then((res) => {
                this.$api.product
                  .FinishedProduceCraftWorkTask({
                    workTaskID: this.rowID,
                  })
                  .then((res) => {
                    this.getAllMaterils();
                    this.showAddDialog = false;
                    this.$message({
                      type: "success",
                      message: "完成成功!",
                    });
                  });
              });
          } else {
            this.machiaForm.exceptionDataList.forEach((item) => {
              item.beginPageNo = Number(item.beginPageNo);
              item.endPageNo = Number(item.endPageNo);
              if (item.exceptionReason) {
                item.exceptionReason = item.exceptionReason.join(",");
              }
            });
            if (this.machineState == "已完成") {
              this.$api.product
                .UpdateProduceCraftWorkTask(this.machiaForm)
                .then((res) => {
                  this.$message.success("修改成功");
                  this.getAllMaterils();
                  this.showAddDialog = false;
                });
            } else {
              let state = true;
              console.log(this.machiaForm.exceptionDataList);
              this.machiaForm.exceptionDataList.forEach((item) => {
                if (!item.reelNumber) {
                  state = false;
                }
                item.beginPageNo = Number(item.beginPageNo);
                item.endPageNo = Number(item.endPageNo);
                if (typeof item.exceptionReason == "array") {
                  item.exceptionReason = item.exceptionReason.join(",");
                }
              });
              if (!state) {
                this.$message.warning("请填写异常明细");
                return;
              }
              this.$api.product
                .UpdateProduceCraftWorkTask(this.machiaForm)
                .then((res) => {
                  this.$api.product
                    .FinishedProduceCraftWorkTask({
                      workTaskID: this.rowID,
                    })
                    .then((res) => {
                      this.getAllMaterils();
                      this.showAddDialog = false;
                      this.$message({
                        type: "success",
                        message: "完成成功!",
                      });
                    });
                });
            }
          }
        }
      });
    },

    //查看生产作业
    handleSeeClick(row) {
      this.type = row.machineType;
      this.opsid = -1;
      this.Matitle = "查看生产作业";
      this.canDisablle = true;
      this.allcanDisablle = true;
      const _data = {
        workTaskID: row.workTaskID,
        workTaskNo: row.workTaskNo,
      };
      this.$api.product.GetProduceCraftWorkTaskDetail(_data).then((res) => {
        this.assisList = res.assistantList;
        this.equipment = res.equipmentDataList;
        this.machiaForm = res.baseData;
        this.machiaForm.exceptionDataList = res.exceptionDataList;
        this.machiaForm.mainMaterialDataList = res.mainMaterialDataList;
        this.machiaForm.ingredientsDataList = res.ingredientsDataList;
        this.machiaForm.pageDetailDataList = res.pageDetailDataList;
        this.reasonDataList = res.exceptionReasonList;
        this.machiaForm.exceptionDataList.forEach((item) => {
          item.beginPageNo = Number(item.beginPageNo);
          item.endPageNo = Number(item.endPageNo);
          item.exceptionReason = item.exceptionReason.split(",");
        });
        this.machiaForm.produceUseTime = this.timeFn(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        let time = new Date();
        if (!this.machiaForm.workFinishTime) {
          this.machiaForm.workFinishTime = this.dateFtt(
            "yyyy-MM-dd hh:mm:ss",
            time
          );
        }
        this.finishTime = JSON.parse(
          JSON.stringify(this.machiaForm.workFinishTime)
        );
        var date3 =
          new Date(this.machiaForm.workFinishTime).getTime() -
          new Date(this.machiaForm.workBeginTime).getTime();
        var subMinutes = Math.floor(date3 / (60 * 1000)); //获取总共的分钟差
        //总工时
        this.machiaForm.taskUseTime = res.baseData.taskUseTime;
        //吃饭时间
        this.machiaForm.dinnertime = this.dinnertimeCalculation(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        this.calculationEfficiency();

        // //实际工时
        // this.machiaForm.actualWorkTime =
        //   this.machiaForm.taskUseTime -
        //   this.machiaForm.otherUseTime -
        //   this.machiaForm.dinnertime;
        // this.machiaForm.workShiftNo = 'BC0019'
        this.showAddDialog = true;
      });
    },

    isDuringDate(beginDateStr, endDateStr) {
      var curDate = new Date(),
        beginDate = new Date(beginDateStr),
        endDate = new Date(endDateStr);
      if (curDate >= beginDate && curDate <= endDate) {
        return true;
      }
      return false;
    },

    //判断两个时间相差几天
    getDays(strDateStart, strDateEnd) {
      var strSeparator = "-";
      //日期分隔符   var oDate1;   var oDate2;
      var iDays;
      let oDate1 = strDateStart.split(strSeparator);
      let oDate2 = strDateEnd.split(strSeparator);
      var strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2]);
      var strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2]);
      iDays = parseInt(Math.abs(strDateS - strDateE) / 1000 / 60 / 60 / 24);
      //把相差的毫秒数转换为天数
      return iDays;
    },

    //判断两个日期是否在同一天
    isSameDay(startTime, endTime) {
      const startTimeMs = new Date(startTime).setHours(0, 0, 0, 0);
      const endTimeMs = new Date(endTime).setHours(0, 0, 0, 0);
      return startTimeMs === endTimeMs ? true : false;
    },

    //修改
    handleUpdata(row) {
      this.type = row.machineType;
      this.machineState = row.craftWorkState;
      this.opsid = 2;
      this.rowID = row.workTaskID;
      this.Matitle = "修改生产作业";
      this.canDisablle = true;
      this.allcanDisablle = false;
      const _data = {
        workTaskID: row.workTaskID,
        workTaskNo: row.workTaskNo,
      };
      this.$api.product.GetProduceCraftWorkTaskDetail(_data).then((res) => {
        this.equipment = res.equipmentDataList;

        console.log(this.machiaForm.equipmentCode);
        this.assisList = res.assistantList;
        this.assisList.forEach((e) => {
          e.employeeCode = e.employeeNo;
        });
        this.machiaForm = res.baseData;
        if (this.machiaForm.craftState == 1) {
          this.machiaForm.craftState = "";
        }
        // this.machiaForm.workTaskRemark = ""; //作业备注
        this.reasonDataList = res.exceptionReasonList;
        this.machiaForm.exceptionDataList = res.exceptionDataList;
        this.machiaForm.mainMaterialDataList = res.mainMaterialDataList;
        this.machiaForm.ingredientsDataList = res.ingredientsDataList;
        this.machiaForm.pageDetailDataList = res.pageDetailDataList;
        if (this.equipment.length > 1) {
          this.rulesFrom.equipmentCode[0].required = true;
        } else if (this.equipment.length == 1) {
          this.machiaForm.equipmentCode = this.equipment[0].equipmentNo;
        } else {
          this.rulesFrom.equipmentCode[0].required = false;
        }
        this.machiaForm.exceptionDataList.forEach((item) => {
          item.beginPageNo = Number(item.beginPageNo);
          item.endPageNo = Number(item.endPageNo);
          item.exceptionReason = item.exceptionReason.split(",");
        });
        this.machiaForm.workShiftNo = this.bcList[0].code;
        this.machiaForm.produceUseTime = this.timeFn(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        let time = new Date();
        if (!this.machiaForm.workFinishTime) {
          this.machiaForm.workFinishTime = this.dateFtt(
            "yyyy-MM-dd hh:mm:ss",
            time
          );
        }
        this.finishTime = JSON.parse(
          JSON.stringify(this.machiaForm.workFinishTime)
        );
        // this.machiaForm.workShiftNo = 'BC0019'
        var date3 =
          new Date(this.machiaForm.workFinishTime).getTime() -
          new Date(this.machiaForm.workBeginTime).getTime();
        var subMinutes = Math.floor(date3 / (60 * 1000)); //获取总共的分钟差
        this.finishTime = JSON.parse(
          JSON.stringify(this.machiaForm.workFinishTime)
        );
        //总工时
        this.machiaForm.taskUseTime = subMinutes;
        //吃饭时间
        this.machiaForm.dinnertime = this.dinnertimeCalculation(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        this.calculationEfficiency();

        // //实际工时
        // this.machiaForm.actualWorkTime =
        //   this.machiaForm.taskUseTime -
        //   this.machiaForm.otherUseTime -
        //   this.machiaForm.dinnertime;
        this.showAddDialog = true;
      });
    },

    //作废保存
    handleViodSave() {
      this.$refs.viodForm.validate((valid) => {
        if (valid) {
          this.$api.system
            .DisableProduceCraftWorkTask(this.viodForm)
            .then((res) => {
              this.$message({
                type: "success",
                message: "作废成功!",
              });
              this.voidDialog = false;
              this.getAllMaterils();
            });
        }
      });
    },

    //作废
    handleDone(row) {
      this.viodForm.workTaskID = row.workTaskID;
      this.viodForm.reason = "";
      this.voidDialog = true;
      return;
      this.$confirm("是否确定作废?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let obj = {
            workTaskID: row.workTaskID,
            reason: "", //作废原因
          };
          this.$api.system.DisableProduceCraftWorkTask(obj).then((res) => {
            this.$message({
              type: "success",
              message: "作废成功!",
            });
            this.getAllMaterils();
          });
        })
        .catch(() => {});
    },

    //检验机台计算
    JYcalculation() {
      if(this.machiaForm.cropCount){
        this.machiaForm.otherTotalMeters = (this.machiaForm.cropCount/this.machiaForm.perGroupCount)*(Number(this.machiaForm.skipDistance)+Number(this.machiaForm.perGroupHeight))-this.machiaForm.skipDistance
      }
    },

    //模切机台计算
    MQcalculation() {
    if(this.machiaForm.cropCount){
      this.machiaForm.otherTotalMeters = (Number(this.machiaForm.makeup_SkipDistance)+Number(this.machiaForm.knifeVersionHieght))*this.machiaForm.cropCount-this.machiaForm.makeup_SkipDistance
    }
      // this.machiaForm.dieCuttingTotalMeters =
      //   Number(
      //     this.machiaForm.cropCount * this.machiaForm.makeup_SkipDistance
      //   ) / 1000;
      // this.machiaForm.dieCuttingTotalMeters = Number(
      //   this.machiaForm.dieCuttingTotalMeters
      // );
      // this.efficiency();
    },

    //其它机台计算
    QTcalculation() {
      //计算良品米数
      this.machiaForm.goodProductsMeters =
        Number(this.machiaForm.otherTotalMeters) -
        Number(this.machiaForm.defectiveProductsMeters);
      this.machiaForm.goodProductsMeters = Number(
        this.machiaForm.goodProductsMeters
      );

      if (
        this.machiaForm.defectiveProductsMeters &&
        this.machiaForm.otherTotalMeters
      ) {
        //计算不良率
        this.machiaForm.otherDefectiveRate = Number(
          (this.machiaForm.defectiveProductsMeters /
            this.machiaForm.otherTotalMeters) *
            100
        );
      }
      this.machiaForm.otherDefectiveRate = parseInt(
        this.machiaForm.otherDefectiveRate.toFixed(2)
      );
      this.efficiency();
    },

    calculationEfficiency() {
      //实际工时
      this.machiaForm.actualWorkTime =
        this.machiaForm.taskUseTime -
        this.machiaForm.otherUseTime -
        this.machiaForm.dinnertime;

      if (this.type == "检验") {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.examineTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      } else if (this.type == "模切") {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.dieCuttingTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      } else {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.otherTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      }
    },

    //工作效率计算
    efficiency() {
      //判断其他时间不能大于总工时减去吃饭时间
      if (
        this.machiaForm.otherUseTime >
        this.machiaForm.taskUseTime - this.machiaForm.dinnertime
      ) {
        this.machiaForm.otherUseTime =
          this.machiaForm.taskUseTime - this.machiaForm.dinnertime;
      }

      //实际工时
      this.machiaForm.actualWorkTime =
        this.machiaForm.taskUseTime -
        this.machiaForm.otherUseTime -
        this.machiaForm.dinnertime;

      if (this.type == "检验") {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.examineTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      } else if (this.type == "模切") {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.dieCuttingTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      } else {
        //实际效率
        if (this.machiaForm.actualWorkTime > 0) {
          this.machiaForm.workEfficiency = Math.ceil(
            (this.machiaForm.otherTotalMeters /
              this.machiaForm.actualWorkTime) *
              60
          );
        } else {
          this.machiaForm.workEfficiency = 0;
        }
      }
      this.$forceUpdate();
    },

    //副手人员选择事件
    getEmployee(val) {
      //  this.contractForm.contractSigningPerson = val.employeeCode
      // this.contractForm.contractSigningPersonName = val.employeeName

      if (this.assisList.length === 0) {
        this.assisList.push({
          employeeCode: val.employeeCode,
          employeeName: val.employeeName,
        });
      } else {
        const checked = this.assisList.some((item) => {
          if (item.employeeCode === val.employeeCode) {
            return true;
          }
        });
        if (!checked) {
          this.assisList.push({
            employeeCode: val.employeeCode,
            employeeName: val.employeeName,
          });
        }
      }
    },

    deletrPer(index) {
      if (this.allcanDisablle) {
        return;
      } else {
        this.assisList.splice(index, 1);
      }
    },

    openPer() {
      if (this.allcanDisablle) {
        return;
      } else {
        this.isperShow = true;
      }
    },

    getWorkExceptionTypeDataList() {
      this.$api.system.GetWorkExceptionTypeDataList({}).then((res) => {
        this.ExceptionTypeList = res;
      });
    },

    timeFn(d1, d2) {
      if (d1 && d2) {
        // 如果时间格式是正确的，那下面这一步转化时间格式就可以不用了
        const dateBegin = new Date(d1.replace(/-/g, "/")); // 将-转化为/，使用new Date
        const dateEnd = new Date(d2.replace(/-/g, "/")); // 获取当前时间
        const dateDiff = dateEnd.getTime() - dateBegin.getTime(); // 时间差的毫秒数
        const leave1 = dateDiff % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数
        // 计算相差分钟数
        const leave2 = leave1 % (3600 * 1000); // 计算小时数后剩余的毫秒数
        const minutes = Math.floor(leave1 / (60 * 1000)); // 计算相差分钟数
        return minutes;
      }
    },

    addExecp() {
      this.machiaForm.exceptionDataList.push({
        index: this.index,
        beginPageNo: 0,
        endPageNo: 0,
        exceptionNumberSegment: "",
        exceptionType: this.ExceptionTypeList[0].exceptionType,
        exceptionReason: "",
      });
      this.index++;
      console.log(this.machiaForm.exceptionDataList);
    },

    //选择物料
    refuseListsMateriAll(value) {
      value.forEach((item) => {
        this.machiaForm.ingredientsDataList.push(item);
      });
      this.machiaForm.ingredientsDataList = this.unique(
        this.machiaForm.ingredientsDataList
      );
      // this.machiaForm.ingredientsDataList = value
    },

    //添加页码明细
    handleAddPage() {
      this.machiaForm.pageDetailDataList.push({
        index: this.indexPage,
        pageFileName: "",
        totalPageCount: 0,
        beginNo: 0,
        endNo: 0,
        remark: "",
      });
      this.indexPage++;
    },

    //完成生产作业
    doneWork(row) {
      this.type = row.machineType;
      this.opsid = 0;
      this.rowID = row.workTaskID;
      this.Matitle = "完成生产作业";
      this.canDisablle = true;
      this.allcanDisablle = false;
      let time = new Date();

      const _data = {
        workTaskID: row.workTaskID,
        workTaskNo: row.workTaskNo,
      };
      this.$api.product.GetProduceCraftWorkTaskDetail(_data).then((res) => {
        this.assisList = res.assistantList;
        this.machiaForm = res.baseData;
        this.machiaForm.craftState = "";
        this.machiaForm.exceptionDataList = res.exceptionDataList;
        this.machiaForm.mainMaterialDataList = res.mainMaterialDataList;
        this.machiaForm.ingredientsDataList = res.ingredientsDataList;
        this.machiaForm.pageDetailDataList = res.pageDetailDataList;
        this.reasonDataList = res.exceptionReasonList;
        this.machiaForm.exceptionDataList.forEach((item) => {
          item.beginPageNo = Number(item.beginPageNo);
          item.endPageNo = Number(item.endPageNo);
          item.exceptionReason = item.exceptionReason.split(",");
        });
        this.machiaForm.produceUseTime = this.timeFn(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );
        // this.machiaForm.workShiftNo = 'BC0019'
        this.machiaForm.workFinishTime = this.dateFtt(
          "yyyy-MM-dd hh:mm:ss",
          time
        );
        var date3 =
          new Date(this.machiaForm.workFinishTime).getTime() -
          new Date(this.machiaForm.workBeginTime).getTime();
        var subMinutes = Math.floor(date3 / (60 * 1000)); //获取总共的分钟差
        //总工时
        this.machiaForm.taskUseTime = subMinutes;
        this.finishTime = JSON.parse(
          JSON.stringify(this.machiaForm.workFinishTime)
        );

        //吃饭时间
        this.machiaForm.dinnertime = this.dinnertimeCalculation(
          this.machiaForm.workBeginTime,
          this.machiaForm.workFinishTime
        );

        //实际工时
        this.machiaForm.actualWorkTime =
          this.machiaForm.taskUseTime -
          this.machiaForm.otherUseTime -
          this.machiaForm.dinnertime;
        this.showAddDialog = true;
      });
      // this.$confirm("是否确定完成该作业?", "提示", {
      //   confirmButtonText: "确定",
      //   cancelButtonText: "取消",
      //   type: "warning",
      // })
      //   .then(() => {
      //     this.saveMachina();
      //   })
      //   .catch(() => {});
    },

    //页码明细选择事件
    handlePageChange(e) {
      this.pageChecked = e;
    },

    //删除页码明细
    handleDeletePage() {
      if (this.pageChecked.length < 1) {
        this.$message.warning("请选择要删除的明细");
      } else {
        this.pageChecked.forEach((j) => {
          if (j.recordID) {
            this.machiaForm.pageDetailDataList =
              this.machiaForm.pageDetailDataList.filter((e) => {
                return e.recordID != j.recordID;
              });
          } else {
            this.machiaForm.pageDetailDataList =
              this.machiaForm.pageDetailDataList.filter((e) => {
                return e.index != j.index;
              });
          }
        });
        this.$forceUpdate();
      }
    },

    //辅料明细选择事件
    handleMaterialChange(e) {
      this.materiaChecked = e;
    },

    //获取班次
    getBC() {
      const _d = {
        isDelete: 0,
        isDisable: 0,
        likeWords: "",
        pageIndex: 1,
        pageSize: 30,
      };

      this.$api.system.GetMatchPageProductClasss(_d).then((res) => {
        this.bcList = res.list;
      });
    },

    //删除辅料明细
    handleDeleteMaterial() {
      if (this.materiaChecked.length < 1) {
        this.$message.warning("请选择要删除的辅料");
      } else {
        this.materiaChecked.forEach((j) => {
          this.machiaForm.ingredientsDataList =
            this.machiaForm.ingredientsDataList.filter((e) => {
              return e.stockGoodsID != j.stockGoodsID;
            });
        });
        this.$forceUpdate();
        console.log(this.machiaForm.ingredientsDataList);
      }
    },

    //异常明细选中事件
    handleAbnormalChange(e) {
      this.abnormalChecked = e;
    },

    //删除异常明细
    handleDeleteAbnormal() {
      if (this.abnormalChecked.length < 1) {
        this.$message.warning("请选择要删除的明细");
      } else {
        this.abnormalChecked.forEach((j) => {
          if (j.exceptionID) {
            this.machiaForm.exceptionDataList =
              this.machiaForm.exceptionDataList.filter((e) => {
                return e.exceptionID != j.exceptionID;
              });
          } else {
            this.machiaForm.exceptionDataList =
              this.machiaForm.exceptionDataList.filter((e) => {
                return e.index != j.index;
              });
          }
        });
        this.$forceUpdate();
      }
    },

    //查看工单
    handleSeeBill(row) {
      if(!row.produceTaskBillNo){
        this.$message.error('暂无生产单号！')
        return
      }
      this.$router.push({
        path: "/production/productionOrderNewDetail", // 跳转的路径
        query: {
          produceTaskBillNo: row.produceTaskBillNo,
          produceTaskID: row.produceTaskID,
          productCode: row.productCode,
          typeStatus: 1,
        },
      });
    },

    //获取列表
    getAllMaterils() {
      const parmas = this.search;
      this.searchLoading = true;
      this.isShowOption = false;
      this.$api.system
        .GetPageProduceCraftWorkTasksForSacnningWork(parmas)
        .then((res) => {
          this.isShowOption = true;
          let list = res.list;
          list.forEach((item) => {
            if (item.isDisabled == 0) {
              if (item.craftWorkState == 1) {
                item.craftWorkState = "已完成";
              } else if (item.craftWorkState == 0) {
                item.craftWorkState = "作业中";
              } else {
                item.craftWorkState = "已停工";
              }
            } else {
              item.craftWorkState = "已作废";
            }
          });
          this.tableData.tbody = res.list;
          this.search.total = res.totalCount;
          this.searchLoading = false;
        })
        .catch(() => {
          this.searchLoading = false;
          this.isShowOption = true;
        });
    },

    // 获取列表表格表头
    getTableHead() {
      console.log(this.$config.ScanningWorkTabel);
      const parmas = {
        tableCode: this.$config.ScanningWorkTabel,
      };
      this.$api.common.getAllTableHead(parmas).then((res) => {
        res.sort(arraySort("columnSort"));
        this.tableData.thead = res;
        // 得到客户汇总所有数据列表
        this.getAllMaterils();
      });
    },
    // 删除基础数据分组
    deleteMaterielClass(data) {
      const parmas = {
        entityID: data.groupID,
      };
      this.$confirm("确定删除该分组, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.$api.mater.DeleteGoodsGroup(parmas).then(() => {
          this.getAllMaterils();
          this.$message({
            message: "删除成功",
            type: "success",
          });
        });
      });
    },
    // 清除所有查询条件
    Refresh() {
      this.search.pageIndex = 1;
      // this.search = this.$options.data().search
      this.getAllMaterils();
    },

    //切换禁用/启用状态
    handleSwich() {
      this.search.pageIndex = 1;
      this.getAllMaterils();
    },

    // 新建弹框关闭事件
    closeDialog() {
      if (this.$refs.materForm) {
        this.$refs.materForm.resetFields();
      }
      this.materForm = this.$options.data().materForm;
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-form--label-top .el-form-item__label {
  padding: 0;
}

::v-deep .dialogInlineForm .el-form-item__content {
  margin-right: 0;
}

.list-item {
  float: left;
  width: 32%;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #e6e6e6;
}

.finish {
  background: #f0f9eb;
  color: #67c23a;
  border-color: #67c23a;
}

.conduct {
  background: #ecf5ff;
  color: #3967ff;
  border-color: #3967ff;
}

.conduct:hover {
  color: #fff;
  background: #3967ff;
}

.head-info {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e6e6e6;
  padding: 0 16px;
}

.item-content {
  margin-top: 8px;
  padding: 16px;

  h1 {
    text-align: center;
    font-size: 26px;
  }

  p {
    text-align: center;
  }
}

.materielList {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}

.addWuliaoBox {
  padding: 10px 16px;
}

.subTip {
  border-bottom: 1px #e6e6e6 solid;
  background: #f5f6f9;
  padding: 8px 16px;
}

.container {
  height: 100%;
}

.permangeRg {
  border: 1px solid #e6e6e6;
  background: #fff;
  margin-left: 10px;
  height: 100%;
  width: calc(100% - 280px);

  .mainTT {
    font-size: 16px;
    font-weight: bold;
    width: 100%;
    padding: 18px 16px;
    padding-bottom: 0;
  }
}

.permanageLf {
  width: 280px;
  height: 100%;
  border: 1px solid #e6e6e6;
  background: #fff;

  .kuOP {
    display: none;
  }

  li {
    padding: 9px 16px;
    cursor: pointer;

    &:hover {
      background: #3f61f110;
      color: #3f61f1;

      .kuOP {
        display: block !important;
      }
    }
  }

  li.on {
    background: #3f61f110;
    color: #3f61f1;
  }

  .allMateriel {
    line-height: 44px;
    padding-left: 16px;

    &:hover {
      background: #3f61f110;
      color: #3f61f1;
    }
  }

  .allMateriel.crt {
    background: #3f61f110;
    color: #3f61f1;
  }
}

.navTT {
  line-height: 22px;
  padding: 16px;
}

.areasOp {
  li {
    padding: 8px 16px;
    cursor: pointer;

    &:hover {
      background: #f6f6f6;
    }
  }
}

.lNavt {
  padding-right: 4px;
  background: #f7f8fa;

  .itemCon {
    display: flex;
    margin: 10px;
    padding: 0 5px;
    width: 100%;
  }
}

.colorList {
  margin-top: 10px;

  li {
    border: 1px solid #eeeeef;
    margin-bottom: 10px;

    .fName {
      position: relative;

      &:before {
        content: "";
        position: absolute;
        left: 0;
        height: 22px;
        border-left: 3px solid #3f61f1;
        top: -1px;
      }
    }

    .colorCon {
      line-height: 22px;
      padding: 16px;
    }
  }
}

.newLayeeCon {
  margin-top: 10px;

  .el-button {
    width: 100%;
  }
}

.tabCon {
  width: 100%;
  padding: 0 16px;

  .btnlist {
    display: flex;
    justify-content: end;
    padding: 0 16px;
    margin: 16px;
  }
}

.tagsBox {
  display: flex;
  flex: 1;
  height: 100%;
  width: 100%;

  .tagsRgBox {
    width: 320px;
    flex-shrink: 0;
    height: 100%;
    border-left: 1px solid #e6e6e6;
    background: #fff;
    overflow: auto;

    .tabBox {
      ul {
        li {
          width: 33.3%;
          text-align: center;
          height: 32px;
          line-height: 32px;
          border-right: 1px solid #e6e6e6;
          background: #f7f8faff;
          border-bottom: 1px solid #e6e6e6;
          cursor: pointer;

          &:last-child {
            border-right: none;
          }

          &.on {
            background: #fff;
            border-bottom: 1px solid #fff;
          }
        }
      }
    }
  }
}

.permain {
  // align-items: baseline;
  line-height: 40px;
  height: 40px;

  .input {
    width: 100%;
    height: 28px;
    line-height: 28px;
    border-radius: 4px 0 0 4px;
    border: 1px solid #dcdfe6;

    span {
      display: inline-block;
      font-size: 12px;
      height: 22px;
      line-height: 22px;
      padding: 2px 5px;
      background-color: #f5f6f9;
      margin: 2px 5px;
    }
  }

  .bgc57 {
    height: 28px;
    background-color: #f5f7fa;
    border-radius: 0px 4px 4px 0px;
    margin-left: -1px;
  }
}

.cwapper {
  flex: 1;
  flex-direction: column;
  margin-left: 8px;

  .vss {
    height: 100%;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    overflow: hidden;
  }
}

.infoSCDD {
  background-color: #fff;
  box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  border: 1px solid #e6e6e6;
  padding: 16px;
  margin-bottom: 8px;

  span {
    margin-right: 20px;
    color: #999aaa;
  }
}

.tableCon {
  border: 1px solid #e6e6e6;
}

.cHeader {
  text-align: start;
  font-weight: 600;
  line-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid #e6e6e6;
}

.fleft {
  border-right: 1px solid #d8d8d8;
  padding: 16px;
}

.fright {
  padding: 16px;

  .count {
    display: flex;
    align-items: center;
    color: #999aaa;
  }

  .el-form-item:not(:last-child) {
    margin-bottom: 8px;
  }
}

.subTipBtn {
  border-bottom: 1px #e6e6e6 solid;
  background: #f5f6f9;
  padding: 8px 16px;
}

.cenCon {
  width: 260px;
  height: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: #fff;
  border-right: 1px solid #e6e6e6;

  .itemCenter {
    margin: 10px 0;

    .cenItem {
      margin: 5px 0;
    }

    .carftItem {
      padding: 5px 0;
      font-size: 12px;

      &.active {
        background-color: #f7f8fa;

        .intax {
          background-color: #3f61f1;
          color: #ffffff;
        }

        .name_text {
          color: #3f61f1;
        }
      }

      div {
        margin: 10px;
        font-weight: 400;
        color: #999aaa;
        padding-left: 50px;
      }

      .name {
        padding-left: 0px;
      }

      .intax {
        display: inline-block;
        background: #f5f6f9;
        border-radius: 2px;
        padding: 5px;
        width: 40px;
        text-align: center;
        margin-right: 10px;
      }
    }
  }

  .addPeoduct {
    cursor: pointer;
    background-color: #3f61f1;
    text-align: center;
    color: #ffffff;
    border-radius: 4px;
    margin: 16px;
    padding: 10px 0;
  }
}

.PBinfo {
  width: 30%;
  margin: 0 10px;
  display: inline-block;
}

.colorPic {
  height: 100%;
  margin: 0 0 5px 0;
  overflow: hidden;

  .img_c {
    width: 250px;
    height: 250px;
    align-items: center;
    justify-content: center;
    display: flex;
    background-color: #e6e6e6;
    margin: 5px 5px;
    // text-align: center;
    position: relative;

    .text {
      position: absolute;
      top: 0;
      left: 0;
      font-size: 12px;
      font-weight: 400;
      color: #ffffff;
      line-height: 22px;
      background: #000000;
      padding: 2px 5px;
      border-radius: 0px 0px 4px 0px;
      opacity: 0.5;
    }

    .yulan {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      position: absolute;
      bottom: 10px;
      right: 16px;
      z-index: 8;
      color: #fff;
      background: #7f7f7f;
    }

    .img_i {
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 100%;
    }
  }
}

.subTip {
  border-bottom: 1px #e6e6e6 solid;
  background: #f5f6f9;
  padding: 13px 16px;
  margin-bottom: 10px;
}

.formBox {
  padding: 0 16px;

  .order {
    padding: 10px 0;
  }
}

.leftCon {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  width: 320px;
  padding: 0 0 16px;
  border-radius: 4px;
  border: 1px #e6e6e6 solid;
}

.cenright {
  flex: 1;
  background-color: #ffffff;
  height: 100%;
  overflow: auto;

  .zy_add {
    margin: 16px 16px;
  }

  .zy_item {
    background: #ffffff;
    border: 1px solid #eeeeee;
    margin: 0 0 16px;

    .zy_header {
      display: flex;
      align-items: center;
      background: #f5f6f9;
      padding: 5px 5px 5px 16px;

      span {
        margin-right: 20px;
        color: #999aaa;
      }
    }

    .zy_info {
      padding: 16px;
      display: flex;
      flex-wrap: wrap;
      color: #999aaa;

      .divt {
        width: 33%;
        margin: 8px 0;
      }

      .cot {
        width: 100%;
      }

      .bigdialogTbCon {
        width: 100%;
        border: 1px solid #eeeeee;

        .ht {
          line-height: 44px;
          width: 100%;
          background: #f7f8fa;
          margin: 0;
          padding: 0 16px;

          span {
            font-weight: 600;
            color: #333333;
          }
        }
      }
    }
  }
}

.orderForm {
  height: calc(100%);
  width: 100%;
}

.mainCenter {
  height: calc(100% - 52px);
  width: 100%;
  overflow-x: hidden;
  padding: 8px;
}

.container {
  height: 100%;
  width: 100%;
}

.tagCon {
  width: 100%;
  flex: 1;
  overflow-x: hidden;
  margin: 0px 0 0 10px;
  background-color: #ffffff;

  .cginfo {
    margin: 0 16px;
  }

  .selectCon {
    line-height: 44px;
    text-align: center;
    background: #ffffff;
    border-radius: 4px 4px 0px 0px;
    border: 1px solid #e6e6e6;

    span {
      display: inline-block;
      margin: 0 32px;
      font-size: 16px;
      line-height: 44px;
      font-weight: 600;
      color: #333333;
      cursor: pointer;

      &.select {
        color: #3f61f1;
        border-bottom: 2px solid #3f61f1;
      }
    }
  }

  .tagList {
    box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.05);
    border: 1px solid #e6e6e6;
    margin: 16px;

    .listNav {
      height: 44px;
      padding: 0 14px;
      background: #f5f6f9;
      border-bottom: 1px solid #e6e6e6;
    }

    .tagShow {
      background-color: #ffffff;
      border: 1px solid #e4e7ed;

      .tagBaseList {
        padding: 14px;
        padding-bottom: 8px;

        li {
          line-height: 24px;
          width: 50%;
          margin: 5px 0;
        }

        .titles {
          width: 100px;
        }
      }

      .layerTable {
        padding: 16px;
        padding-top: 0;

        .border {
          border: solid #ebeef5;
          border-width: 0 1px 0 1px;
        }
      }
    }
  }
}

.orderRemark {
  line-height: 24px;
  padding-bottom: 16px;
}

.orderContent {
  flex: 1;
}

.drgCard {
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #eeeeee;
  padding: 5px 0;
  text-align: center;
  // line-height: 44px;
  align-items: center;

  .line_div {
    width: 120px;

    &.w15 {
      width: 15%;
    }

    &.w10 {
      width: 80px;
    }

    &.mlr10 {
      margin: 0 10px 0 0;
    }
  }
}

.tableBox {
  margin-top: 10px;
  overflow: hidden;
  border: 1px #e6e6e6 solid;
  border-bottom: none;

  .bigdialogTable {
    span {
      display: inline-block;
      text-align: center;
      font-weight: bold;
      width: 120px;

      &.w15 {
        width: 15%;
      }

      &.w10 {
        width: 10%;
      }
    }
  }

  .tt {
    height: 38px;
    line-height: 38px;
    background: #f7f8fa;
    padding-left: 16px;
  }

  .title {
    border-radius: 0;
    border: 1px solid #e6e6e6;
  }
}

::v-deep .formItem {
  .el-form-item {
    margin-bottom: 0;
    color: #999aaa;
  }

  .min_item .el-form-item__label {
    line-height: 28px;
    color: #999aaa;
  }

  .min_item .el-form-item__content {
    line-height: 28px;
  }

  .el-form-item__label {
    line-height: 28px;
    color: #999aaa;
  }

  .el-form-item__content {
    line-height: 28px;
    height: 28px;
    color: #333;

    .el-input-group {
      vertical-align: initial;
      margin-top: 0;
    }
  }

  .el-select,
  .el-date-editor.el-input {
    width: 100%;
  }

  .el-textarea {
    vertical-align: middle;
  }
}
</style>
<style lang="scss">
.el-loading-mask {
  top: 0;
}

.operations {
  display: flex;
  align-items: center;
}

.operations i {
  padding-right: 5px;
}

.operations > span:first-child {
  padding-right: 5px;
}

.operations > span {
  font-weight: 400;
  color: #000;
  cursor: pointer;
}

.operations > span:last-child {
  padding-left: 5px;
}

.d_treeBox {
  margin-right: 0 !important;
  border-radius: 10px 0 0 10px;
  border-right: none !important;
}

.case {
  background: #fff;
  border-left: 1px solid #e6e6e6;
}
</style>
